package com.slowfly.rule.engine.result;

import com.slowfly.rule.engine.enums.StrategyStatusEnum;
import com.slowfly.rule.engine.model.Flow;
import com.slowfly.rule.engine.model.Fuse;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author shalongfei
 * @since 2024-02-22
 */
@Data
public class StrategyResult implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    private Integer id;

    /**
     * 场景id
     */
    private Integer sceneId;

    /**
     * 策略名称
     */
    private String name;

    /**
     * 优先级
     */
    private Integer priority;

    /**
     * 状态；1：下线，2：标记，3：上线，4：熔断
     */
    private Integer status;

    /**
     * 决策流
     */
    private List<Flow> flows;

    /**
     * 熔断配置
     */
    private Fuse fuse;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    public String getStatusName() {
        return StrategyStatusEnum.getNameByCode(status);
    }

}
